package cj.web.tel.dao;
/*
 *  
 *  
*/
import java.util.List;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.tel.domain.FloorInfor;

/**
 * 
 * @author 
 *
 */
@DAO
public interface FloorInforDAO{
	
	@SQL("select * from FloorInfor where deleteFlag=1 ")
	List<FloorInfor> queryByAll();
	
	@SQL("SELECT * FROM FloorInfor WHERE deleteFlag=1 #if(:t.name != null){ AND name LIKE '%##(:t.name)%' } ORDER BY orderNo,updateAt DESC LIMIT :t.start,:t.length ")
    List<FloorInfor> query(@SQLParam("t") FloorInfor floorInfor);
		
	@SQL("SELECT count(1) FROM FloorInfor WHERE deleteFlag=1 #if(:t.name != null){ AND name LIKE '%##(:t.name)%' } ")
    int querySize(@SQLParam("t") FloorInfor floorInfor);
    
    @SQL("select * from FloorInfor where id=:1 ")
    FloorInfor queryById(int id);
    
    @SQL("INSERT INTO FloorInfor ("
			        		+ "name,"
			        		+ "orderNo,"
			        		+ "deleteFlag,"
			        		+ "createUser,"
			        		+ "createAt,"
			        		+ "updateUser,"
			        		+ "updateAt"
							+") VALUES ("
							+ ":t.name,"
							+ ":t.orderNo,"
							+ "1,"
							+ ":t.createUser,"
							+ "now(),"
							+ ":t.updateUser,"
							+ "now()"
					+")")
    void create(@SQLParam("t") FloorInfor floorInfor);
	
	@SQL("UPDATE FloorInfor SET name=:t.name,orderNo=:t.orderNo,updateUser=:t.updateUser,updateAt=now() WHERE id=:t.id")
    void update(@SQLParam("t") FloorInfor floorInfor);
    
    @SQL("UPDATE FloorInfor SET deleteFlag=0 WHERE id=:1 ")
    void deleteById(int id);
}